﻿
@{
    ViewData["Title"] = "Login";
    Layout = null;
}
@model LoginViewModel

<script src="~/lib/layui-v2.2.3/layui/layui.js"></script>
<link href="~/css/manage/login.css" rel="stylesheet" />
<link href="~/lib/layui-v2.2.3/layui/css/layui.css" rel="stylesheet" />
<link href="~/css/manage/iconfont.css" rel="stylesheet" />
<link href="http://siyouku.cn/Content/animate.css" rel="stylesheet" />
<div class="layadmin-user-login" id="LAY-user-login">
    <div class="layadmin-user-login-main animated zoomIn">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2>CodeFrame</h2>
            <p>基于asp.net core 的web开发框架 </p>
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon" for="LAY-user-login-username">
                    <i class="iconfont icon-yonghu"></i>
                </label>
                <input type="text" name="username" value="wenqing" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
            </div>
            <div class="layui-form-item">
               
                <label class="layadmin-user-login-icon layui-icon" for="LAY-user-login-password">
                    <i class="iconfont icon-lock"></i>
                </label>
                <input type="password" name="password" value="123456" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
            </div>
            <div class="layui-form-item">
                <div>
                    <input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
                </div>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-btn-fluid" id="btnlogin" lay-submit lay-filter="LAY-user-login-submit">登 入</button>
            </div>
            <div class="layui-form-item layadmin-user-login-other">
                <label>社交账号登入</label>
                <a href="javascript:;"><i class="iconfont icon-QQ layui-icon-login-qq"></i></a>
                <a href="javascript:;"><i class="iconfont icon-wechat layui-icon-login-wechat "></i></a>
                <a href="javascript:;"><i class="iconfont icon-weibo layui-icon-login-weibo"></i></a>
            </div>
        </div>
    </div>

    <div class="layadmin-user-login-footer">

        <p>© 2018 <a href="http://www.siyouku.cn/" target="_blank">siyouku.cn</a></p>
        <p>
            <span><a href="http://www.layui.com/admin/#get" target="_blank">获取授权</a></span>
            <span><a href="http://www.layui.com/admin/pro/" target="_blank">在线演示</a></span>
            <span><a href="http://www.layui.com/admin/" target="_blank">前往官网</a></span>
        </p>
    </div>


</div>
 
<script>
    layui.use(['form'], function () {
        var $ = layui.$
            , setter = layui.setter

            , form = layui.form
            , router = layui.router();

        form.render();

        //提交
        form.on('submit(LAY-user-login-submit)', function (obj) {
            $("#btnlogin").text("正在登入....");
            console.info(obj.field);
            setTimeout(function () {
                $.post('@Url.Action("Login")',
                obj.field,
                function(data) {
                    if (data.Code === 0) {
                         location.href = '@Url.Action("Index","MyHome", new { area = "Manage" })';
                    } else {
                        layer.msg(data.Msg);
                        $("#btnlogin").text("登入");
                    }
                });}, 500);

        });
 

    });
</script>
